home *** CD-ROM | disk | FTP | other *** search
- {$X+,B-,V-,S-,I-} {essential compiler directives}
-
- Program Backbin; { as of 950301}
-
- { Example for the nwBindry unit / NwTP 0.6 API. (c) 1994,1995 R.Spronk }
-
- { Purpose: Backs up the bindery files to the a: drive. }
- { You need to be supervisor-equivalent to run this. }
-
- { Tests the following nwBindry calls:
-
- OpenBindery
- CloseBindery
- }
-
- Uses DOS,nwMisc,nwBindry;
-
- Var BindSeq:byte;
- myObjID:LongInt;
- Version:word;
- s :string;
-
- LABEL enable;
-
- Procedure FileCopy(fn1,fn2:string);
- LABEL 1;
- Var f1,f2 :file;
- buffer :array[1..4096] of byte;
- BytesRead:word;
- begin
- assign(f1,fn1);
- reset(f1,1);
- if ioresult<>0
- then begin
- writeln('Error opening input file:',fn1);
- writeln('>> File wasn''t copied.');
- goto 1;
- end;
- assign(f2,fn2);
- rewrite(f2,1);
- if ioresult<>0
- then begin
- writeln('Error opening output file :',fn2);
- writeln('>> File wasn''t copied.');
- goto 1;
- end;
- REPEAT
- BlockRead(f1,buffer[1],4096,BytesRead);
- BlockWrite(f2,buffer[1],BytesRead);
- UNTIL (BytesRead<4096);
- 1: ;
- close(f1);
- close(f2);
- {$I+}
- end;
-
-
- begin
- writeln('BACKBIN Test program for the nwBindry unit of the NwTP package.');
- writeln('-Backs up the bindery files to drive A');
- writeln;
-
- IF NOT IsShellLoaded
- then begin
- writeln('Load network shell before executing this program.');
- halt(1);
- end;
-
- { need supervisor privileges to run this test }
- GetBinderyAccessLevel(BindSeq,myObjId);
- if bindSeq<>(BS_SUPER_WRITE OR BS_SUPER_READ) { $33}
- then begin
- writeln('You need to be supervisor equivalent to run this program.');
- halt(1);
- end;
-
- writeln;
- writeln('WARNING:');
- writeln('Continue this program ONLY WHEN:');
- writeln('-You are the only user logged in.');
- writeln('-No other users will login in next few minutes.');
- writeln('-You are running Netware 2.15c, 2.2 or 3.x');
- writeln('-A diskette with sufficient space is in the A drive.');
- writeln;
- writeln('-If you have doubts about any of the above points: PLEASE ABORT NOW');
- writeln('-This program was made for test purposes only.');
- writeln;
- write('Type Y <return> to continue, <return> to abort.');
- readln(s);
- if NOT ( s[1] IN ['y','Y'])
- then begin
- writeln('Program aborted..');
- halt(1);
- end;
-
- {determine Advanced Netware version. }
- nwMisc.GetNWVersion(version);
-
- if (Version<215) or (version>399)
- then begin
- writeln('This util only works with NW 2.15+ or 3.x');
- writeln('The bindery files were NOT backed up.');
- halt(1);
- end;
- version:=(version DIV 100);
-
- {Note for final version: make sure no users are logged in. (NwConn functions)}
- {Note for final version: disable user login (see nwServ) }
-
- {close the bindery to backup the files..}
- IF NOT CloseBindery
- then begin
- writeln('Couldn''t close the bindery.');
- writeln('The bindery files were NOT backed up');
- writeln('Error : $',HexStr(NwBindry.Result,2));
- goto enable;
- end;
-
- {back up the bindery files}
- if version=2
- then begin
- FileCopy('SYS:\SYSTEM\NET$BIND.SYS','A:\NET$BIND.OLD');
- FileCopy('SYS:\SYSTEM\NET$BVAL.SYS','A:\NET$BVAL.OLD');
- end
- else begin {3.x}
- FileCopy('SYS:\SYSTEM\NET$OBJ.SYS' ,'A:\NET$OBJ.OLD');
- FileCopy('SYS:\SYSTEM\NET$PROP.SYS','A:\NET$PROP.OLD');
- FileCopy('SYS:\SYSTEM\NET$VAL.SYS' ,'A:\NET$VAL.OLD');
- end;
-
- {open the bindery again}
- IF NOT OpenBindery
- then begin
- writeln('Couldn''t open the bindery after copying the bindery files.');
- writeln('Error : $',HexStr(NwBindry.Result,2),' (',NwBindry.result,')');
- end
- else writeln('The bindery files were successfully backed up.');
-
- {Note for final version: enable users to login (see nwServ) }
-
- enable: ;
-
- end.
-